from config.config import Base
from sqlalchemy import Column,Integer,String,DateTime,Float
#建立表模型
class ad_click_day(Base):
    __tablename__ = 'ad_click_day'
    id = Column(Integer, primary_key=True)
    record_key = Column(String,nullable=True)
    ad_name=Column(String,nullable=True)
    slot=Column(String,nullable=True)
    click_amount=Column(Integer,nullable=True)
    active=Column(Integer,nullable=True)
    from_channel=Column(Integer,nullable=True)
    update_time=Column(DateTime,nullable=True)
class ad_offer(Base):
    #ad_offer
    __tablename__ = 'ad'
    ad_id=Column(Integer, primary_key=True)
    #offer_name=Column(String,nullable=True)修改ad——name
    ad_name=Column(String,nullable=True)
    redirect_url=Column(String,nullable=True)
    descs=Column(String,nullable=True)
    app_id=Column(String,nullable=True)
    net_id=Column(Integer,nullable=True)
    supplier_id=Column(Integer,nullable=True)
    req_method=Column(String,nullable=True)
    area=Column(String,nullable=True)
    create_time=Column(DateTime,nullable=True)
    update_time=Column(DateTime,nullable=True)
    revenue_price=Column(Float,nullable=True)
    #payout_price=Column(Float,nullable=True) 删除
    main_key_expire_time=Column(Integer,nullable=True)
    #s2s_url=Column(String,nullable=True) 删除
    access_type=Column(String,nullable=True)
    offer_platform=Column(String,nullable=True)
    #enddate=Column(DateTime,nullable=True)修改end_date
    end_date=Column(DateTime,nullable=True)
    revenue_model=Column(String,nullable=True)
    #payout_model=Column(String,nullable=True) 删除
    #增加cbkurl和succresponse表
    cbk_url=Column(String,nullable=True)
    succ_response=Column(String,nullable=True)

class adclick_active(Base):
    __tablename__ = 'adclick_active'
    id=Column(Integer, primary_key=True)
    click_id=Column(String,nullable=True)
    slot=Column(String,nullable=True)
    ip = Column(String, nullable=True)
    ua = Column(String, nullable=True)
    area = Column(String, nullable=True)
    click_time = Column(DateTime, nullable=True)
    device_id = Column(String, nullable=True)
    cbk_time = Column(DateTime, nullable=True)
    cbk_url = Column(String, nullable=True)
class apps(Base):
    __tablename__ = 'app'
    count = Column(Integer, nullable=True)
    app_id = Column(String, primary_key=True)
    app_name = Column(String, nullable=True)
    app_store_url = Column(String, nullable=True)
    no_repeat_url = Column(String, nullable=True)
    window_time = Column(Integer,nullable=True )
    succ_response=Column(String,nullable=True)
    note=Column(String,nullable=True)
    #增加
    app_key=Column(String,nullable=True)
    app_update_time=Column(DateTime,nullable=True)
    key_operate_time=Column(DateTime,nullable=True)


class channel(Base):
    __tablename__ = 'channel'
    channel_id=Column(Integer,primary_key=True)
    channel_name=Column(String,nullable=True)
    channel_cbk_url = Column(String, nullable=True)
    descs = Column(String, nullable=True)
    update_time = Column(DateTime, nullable=True)
    email=Column(String,nullable=True)
    succ_response=Column(String,nullable=True)
    pwd=Column(String,nullable=True)
class delivery(Base):
    __tablename__ = 'delivery'
    delivery_id=Column(Integer,primary_key=True)
    slot=Column(String,nullable=True)
    ad_id= Column(Integer, nullable=True)
    channel_id= Column(Integer, nullable=True)
    status= Column(Integer, nullable=True)
    cbk_rate= Column(Integer, nullable=True)
    upurl_rate=Column(Integer, nullable=True)
    req_amount=Column(Integer, nullable=True)
    is_over_req_amount=Column(Integer, nullable=True)
    #增加delivery_name payout_price cap
    delivery_name=Column(String,nullable=True)
    payout_price=Column(Float,nullable=True)
    cap=Column(Integer,nullable=True)
class supplier(Base):
    __tablename__ = 'supplier'
    id=Column(Integer,primary_key=True)
    supplier_name=Column(String, nullable=True)
    succ_response=Column(String, nullable=True)
    cbk_url=Column(String, nullable=True)
    net_id=Column(Integer,nullable=True)
class net(Base):
    __tablename__ = 'net'
    id=Column(Integer,primary_key=True)
    net_name=Column(String,nullable=True)
    company_name=Column(String,nullable=True)
    domain=Column(String,nullable=True)
    whitelist=Column(String,nullable=True)
